-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Error State for Timeline, SelectionCard Component #105
Conversation
WalkthroughThis update introduces a significant enhancement to the UI components library, focusing on adding error handling for key components like the "Timeline" and "SelectionCard." New styles and functionality have been implemented to improve layout, responsiveness, and user interaction, ensuring a more robust experience. The addition of stories for these components further aids in documentation and testing, making it easier for developers to visualize their usage. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant SelectionCard
participant Timeline
User->>SelectionCard: Select option
SelectionCard->>User: Update selection state
User->>Timeline: Check timeline status
Timeline->>User: Display timeline with status
alt Error State
Timeline->>User: Show error message
end
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (7)
react/css/package.json
is excluded by!**/*.json
react/example/package.json
is excluded by!**/*.json
react/modules/Project/package.json
is excluded by!**/*.json
react/modules/core/package.json
is excluded by!**/*.json
react/modules/sample/package.json
is excluded by!**/*.json
react/package.json
is excluded by!**/*.json
react/ui-components/package.json
is excluded by!**/*.json
Files selected for processing (18)
- react/css/CHANGELOG.md (1 hunks)
- react/css/src/digitv2/components/actionbarV2.scss (3 hunks)
- react/css/src/digitv2/components/selectionCardV2.scss (1 hunks)
- react/css/src/digitv2/components/sidebarV2.scss (11 hunks)
- react/css/src/digitv2/components/timelineV2.scss (5 hunks)
- react/css/src/digitv2/index.scss (1 hunks)
- react/example/public/index.html (1 hunks)
- react/ui-components/CHANGELOG.md (1 hunks)
- react/ui-components/src/atoms/CheckBox.js (4 hunks)
- react/ui-components/src/atoms/MobileSidebar.js (3 hunks)
- react/ui-components/src/atoms/SelectionCard.js (1 hunks)
- react/ui-components/src/atoms/Sidebar.js (2 hunks)
- react/ui-components/src/atoms/Timeline.js (5 hunks)
- react/ui-components/src/atoms/index.js (2 hunks)
- react/ui-components/src/atoms/stories/SelectionCard.stories.js (1 hunks)
- react/ui-components/src/atoms/stories/Timeline.stories.js (1 hunks)
- react/ui-components/src/index.js (2 hunks)
- react/ui-components/src/molecules/stories/TimelineMolecule.stories.js (1 hunks)
Files skipped from review due to trivial changes (4)
- react/css/src/digitv2/components/sidebarV2.scss
- react/css/src/digitv2/index.scss
- react/example/public/index.html
- react/ui-components/src/index.js
Additional context used
LanguageTool
react/css/CHANGELOG.md
[duplication] ~4-~4: Possible typo: you repeated a word
Context: ...og ## [0.0.2-beta.15] - 2024-07-30 ### Added - Added Error State for Timeline, SelectionCard...(ENGLISH_WORD_REPEAT_RULE)
Additional comments not posted (50)
react/css/src/digitv2/components/selectionCardV2.scss (7)
1-5
: LGTM!The
.selection-card-container
rule correctly sets up the flex container with appropriate properties.
7-16
: LGTM!The
.selection-card
rule correctly applies flexbox properties, padding, border, and background color using theme variables.
18-20
: LGTM!The
.selection-card.error
rule correctly sets the border color for the error state using a theme variable.
22-51
: LGTM!The
.option
rule correctly applies various properties including padding, border, background color, and responsive font sizes using theme variables.
54-58
: LGTM!The
.option.selected
rule correctly sets the background color, text color, and font weight for the selected state using theme variables.
60-65
: LGTM!The
.option .selectioncard-option-label
rule correctly sets up the label within the option with flex properties.
68-72
: LGTM!The
.option .selectioncardicon
rule correctly sets up the icon within the option with flex properties.react/ui-components/src/atoms/stories/SelectionCard.stories.js (4)
1-24
: LGTM!The default export correctly sets up the storybook configuration for the
SelectionCard
component with various controls and actions.
27-27
: LGTM!The
Template
component correctly renders theSelectionCard
with the provided arguments.
29-39
: LGTM!The common arguments and options are correctly set up for the
SelectionCard
component.
41-99
: LGTM!The stories with different configurations for the
SelectionCard
component are correctly set up and follow standard practices.react/css/CHANGELOG.md (1)
3-5
: Fix the repeated word typo.There is a possible typo due to word repetition in the changelog entry.
- Added Error State for Timeline, SelectionCard Component + Added Error State for Timeline and SelectionCard ComponentLikely invalid or redundant comment.
Tools
LanguageTool
[duplication] ~4-~4: Possible typo: you repeated a word
Context: ...og ## [0.0.2-beta.15] - 2024-07-30 ### Added - Added Error State for Timeline, SelectionCard...(ENGLISH_WORD_REPEAT_RULE)
react/ui-components/src/atoms/CheckBox.js (4)
21-21
: New prophideLabel
added.The
hideLabel
prop is correctly added to the component's props.
39-39
: Condition for displaying label before checkbox.The condition
(isLabelFirst && !hideLabel)
is logically correct and ensures the label is displayed only whenisLabelFirst
is true andhideLabel
is false.
74-74
: Condition for displaying label after checkbox.The condition
(!isLabelFirst && !hideLabel)
is logically correct and ensures the label is displayed only whenisLabelFirst
is false andhideLabel
is false.
108-108
: Prop type forhideLabel
added.The
hideLabel
prop type is correctly declared as a boolean.react/ui-components/src/atoms/SelectionCard.js (7)
1-6
: Necessary imports added.The imports are necessary and correctly used within the component.
7-13
:SelectionCard
component defined.The
SelectionCard
component and its props are correctly defined.
17-36
:handleOptionClick
function implemented.The
handleOptionClick
function is correctly implemented to handle both single and multiple selections, updating the state and calling theonSelectionChanged
callback.
38-62
:IconRender
function implemented.The
IconRender
function is correctly implemented to dynamically import and render icons based on theiconReq
andisActive
parameters, with appropriate error handling.
64-87
:renderOption
function implemented.The
renderOption
function is correctly implemented to render each option, applying the appropriate styles and handling clicks.
89-103
: JSX structure implemented.The JSX structure is correctly implemented, including the main container, options, and error message.
106-121
: Prop types and default export implemented.The prop types and default export are correctly defined.
react/css/src/digitv2/components/timelineV2.scss (5)
68-71
: Styles for.upcoming
class added.The styles for the
.upcoming
class are correctly implemented, setting the text color to a secondary theme color.
Line range hint
116-126
: Styles for.timeline-circle.inprogress:not(.error)
class added.The styles for the
.timeline-circle.inprogress:not(.error)
class are correctly implemented, applying specific styles when the circle is in progress and not in an error state.
Line range hint
131-144
: Nested styles for.timeline-circle
class added.The nested styles for the
.timeline-circle
class, including styles for the.check-icon
class, are correctly implemented.
146-148
: Styles for.timeline-circle.completed
class added.The styles for the
.timeline-circle.completed
class are correctly implemented, setting the background color to a primary theme color.
179-206
: Styles for.digit-timeline-item.error
class added.The styles for the
.digit-timeline-item.error
class are correctly implemented, applying distinct background colors and border styles for items marked as errors.react/css/src/digitv2/components/actionbarV2.scss (6)
147-149
: LGTM!The
.toRight
class correctly appliesmargin-left: auto;
to push the element to the right.
151-153
: LGTM!The
.toLeft
class correctly resetsjustify-content
to its default value.
155-158
: LGTM!The
.action-bar-individual-action-field
class ensures buttons within this field flex to occupy equal space.
161-163
: LGTM!The conditional width ensures the element takes full width if it does not have the
.toRight
class.
176-176
: LGTM!The media query for small screens adjusts the gap, box-shadow, height, and padding for better responsiveness.
Line range hint
178-180
:
LGTM!The
.action-bar-individual-action-field
class within the media query ensures buttons take full width on small screens.react/ui-components/src/atoms/Timeline.js (7)
21-21
: LGTM!The
isError
prop is correctly added to the component's prop list.
58-59
: LGTM!The
defaultLabel
correctly includes a condition to show "Failed!" whenisError
is true.
71-71
: LGTM!The main container's class name is correctly updated to include an "error" class when
isError
is true.
72-72
: LGTM!The timeline circle's class name is correctly updated to include an "error" class when
isError
is true.
73-81
: LGTM!The check icon for completed steps is correctly rendered only when there is no error.
82-90
: LGTM!The error icon is correctly rendered when
isError
is true.
117-117
: LGTM!The timeline date correctly shows "Incomplete" instead of "date" when
isError
is true.react/ui-components/CHANGELOG.md (1)
7-9
: LGTM!The new changelog entry correctly highlights the addition of an "Error State" for the "Timeline" and "SelectionCard" components.
react/ui-components/src/atoms/stories/Timeline.stories.js (1)
218-226
: LGTM! The newErrorTimeline
export is well-defined.The addition of the
ErrorTimeline
export enhances the component by providing an error state configuration.react/ui-components/src/atoms/Sidebar.js (2)
80-80
: LGTM! The dynamic adjustment of thefill
property enhances visual adaptability.The use of the
theme
prop to dynamically adjust thefill
property of theSVG.Search
component improves the component's responsiveness to different themes.
109-109
: LGTM! The enhanced logic for displaying icons is well-implemented.The additional condition to check if the current item is a parent of the selected item ensures a more nuanced representation of item selection.
react/ui-components/src/atoms/MobileSidebar.js (2)
15-16
: LGTM! The addition of theref
prop enhances the component's flexibility.The
ref
prop allows parent components to directly reference the sidebar DOM element, which can be useful for various interactions.Also applies to: 204-204
93-97
: LGTM! The adjustments in the rendering logic improve readability.The use of parentheses around the conditional expression for rendering icons is standardized, enhancing readability without altering the underlying logic.
Also applies to: 100-100
react/ui-components/src/atoms/index.js (2)
87-87
: Import statement forSelectionCard
looks good.The import path and naming convention follow the project's standards.
275-275
: Export statement forSelectionCard
looks good.The export statement is correctly formatted and follows the project's standards.
react/ui-components/src/molecules/stories/TimelineMolecule.stories.js (1)
318-351
:WithError
story looks good.The story correctly demonstrates the error state for the
Timeline
component using theisError
prop. The overall structure and usage are appropriate.
No description provided.